package com.migraine.mapper;

import com.migraine.model.Relationship;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface RelationshipMapper {
    int deleteByPrimaryKey(Integer relationshipid);

    int insert(Relationship record);

    int insertSelective(Relationship record);

    Relationship selectByPrimaryKey(Integer relationshipid);

    int updateByPrimaryKeySelective(Relationship record);

    int updateByPrimaryKey(Relationship record);

    @Select("select relationshipid from relationship where user1name=#{name1} and user2name=#{name2}")
    Integer getRelationshipId(String name1,String name2);

    @Select("select user2name from relationship where user1name=#{name}")
    List<String>  getRelationship(String name);

    @Insert("insert into relationship(user1name,user2name) values (#{name1} , #{name2})")
    boolean insertRelationship(String name1,String name2);

    @Delete("delete from relationship where user1name=#{name1} and user2name=#{name2}")
    boolean deleteRelationship(String name1,String name2);

}